{% extends "admin/layout.html" %}
{% block title %}
    <title>文章列表</title>
{% endblock %}
{% block main %}
    <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
        <h1 class="h2">文章管理</h1>
    </div>

    <p><a href="{{ url_for('admin.admin_post') }}">
        <button type="button" class="btn btn-lg btn-dark">新增文章</button>
    </a></p>
    <div class="table-responsive">
        <table class="table">
            <thead>
            <tr>
                <th>id号</th>
                <th>博客名称</th>
                <th>文章类别</th>
                <th>发表时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% for item in list %}
                <tr>
                    <td>{{ item.id }}</td>
                    <td>{{ item.title }}</td>
                    <td>{{ item.category_id }}</td>
                    <td>{{ item.create_time }}</td>
                    <th>
                        <a href="#">
                            <button type="button" class="btn btn-sm btn-default">编辑</button>
                        </a>
                        <a href="{{ url_for('admin.admin_post_delete', id=item.id) }}">
                            <button type="button" class="btn btn-sm btn-dark">删除</button>
                        </a>
                    </th>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock %}